/*
 * @Description:
 * @Author: dh
 * @Date: 2022-01-21 13:41:19
 * @LastEditors: dh
 * @LastEditTime: 2022-12-28 16:01:49
 */
import { createApp } from 'vue';
import App from './App.vue';
// import Bpp from './views/v-model/index.vue';
import './assets/styles/index.scss';
import router from './router';
import store from './store/vuex';
import pinia from './store/pinia';
import ElementPlus from './plugins/element';
import directive from './directive/index';
import emitter from '@/utils/mitt';
import loading from '@/views/custom-plugins/loading';

const app = createApp(App);
// const bpp = createApp(Bpp);

app.use(ElementPlus);
app.use(directive);
app.use(store);
app.use(pinia);
app.use(router);
// app.mixin()
// app.component()

// TODO 添加全局属性,
// vue2  vue.prototype.$timer = function()()
app.config.globalProperties.$timer = function () {
	return new Date();
};
// 可选添加类型推断, 代码 在 shims-vue.d
app.config.globalProperties.$bus = emitter;

// FIXME 添加自定义插件
app.use(loading, { color: '#fff' });

// TODO 全局异常处理
app.config.errorHandler = (err, vm, info) => {
	console.log('[全局异常]', err, vm, info);
};
app.mount('#app');
// bpp.mount("#B");
console.log(process.env);
